package com.application.mestory.mapper;

import com.application.mestory.entity.MeStory;
import com.application.mestory.entity.MeStoryObject;
import com.application.mestory.jaxb.Story;
import com.application.mestory.jaxb.StoryObject;

public class MeStoryToStory {

	static public Story map(MeStory mestory) {
		Story story = new Story();
		story.setSid(mestory.getId());
		for (MeStoryObject meStoryObject: mestory.getMeStoryObjects()) {
			StoryObject storyObject = new StoryObject();
			storyObject.setHeight(meStoryObject.getHeight());
			storyObject.setImageName(meStoryObject.getImageName());
			storyObject.setLeft(meStoryObject.getLeft());
			storyObject.setSoid(meStoryObject.getId());
			storyObject.setTop(meStoryObject.getTop());
			storyObject.setWidth(meStoryObject.getWidth());
			story.addStoryObject(storyObject);		
		}
		return story;
	}
}
